#pragma once
#include<string>
#include<hash_map>
using namespace std;
using namespace stdext;
using namespace std;
using namespace stdext;
struct less_str {
	bool operator()(const char *  &x, const char *& y) const
	{
		if (strcmp(x, y) > 0)
			return true;
		return false;
	}
};


struct less_wstr {
	bool operator()(const WCHAR *  &x, const WCHAR *& y) const
	{
		if (wcscmp(x, y) > 0)
			return true;
		return false;
	}
};



class strHash :public hash_compare<char * , less_str>
{

public:
	size_t operator()(const char*  _Keyval) const
	{	
		long _Quot = (long)(hash_value(_Keyval) & LONG_MAX);
		ldiv_t _Qrem = _CSTD ldiv(_Quot, 127773);

		_Qrem.rem = 16807 * _Qrem.rem - 2836 * _Qrem.quot;
		if (_Qrem.rem < 0)
			_Qrem.rem += LONG_MAX;
		return ((size_t)_Qrem.rem);
	}

	bool operator()(const char *  _Keyval1, const char *_Keyval2) const
	{	
		return (comp(_Keyval1, _Keyval2));
	}
} ;


class wstrHash :public hash_compare<WCHAR * , less_wstr>
{

public:
	size_t operator()(const WCHAR*  _Keyval) const
	{	
		long _Quot = (long)(hash_value(_Keyval) & LONG_MAX);
		ldiv_t _Qrem = _CSTD ldiv(_Quot, 127773);

		_Qrem.rem = 16807 * _Qrem.rem - 2836 * _Qrem.quot;
		if (_Qrem.rem < 0)
			_Qrem.rem += LONG_MAX;
		return ((size_t)_Qrem.rem);
	}

	bool operator()(const WCHAR *  _Keyval1, const WCHAR *_Keyval2) const
	{	
		return (comp(_Keyval1, _Keyval2));
	}
} ;







#ifdef  UNICODE   

#ifndef TSTRHASH
typedef  wstrHash _tstrHash;
#define TSTRHASH
#endif /* !_TCHAR_DEFINED */


#else

#ifndef TSTRHASH
typedef  strHash _tstrHash;
#define TSTRHASH
#endif /* !_TCHAR_DEFINED */

#endif /* !_TCHAR_DEFINED */

